package interview.huawei.tjt.training.test;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Demo {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
            String ransomNode = scanner.nextLine();
            String maganize = scanner.nextLine();
            int p1 = 0;
            int p2 = 0;
            boolean result = false;
        List<Integer> nums = new ArrayList<>();
        for (int i = 0 ; i < maganize.length(); i ++) {
            if ( !nums.contains(i) && p1 < ransomNode.length() && ransomNode.charAt(p1) == maganize.charAt(i) ) {
                nums.add(i);
                p2 ++;
                p1 ++;
            }
        }
        if ( p2 >= ransomNode.length() ) {
            result = true;
        }
        System.out.println(result);

    }

}
